package datasource.zhuocan.cn.druid;

import datasource.zhuocan.cn.util.JDBCUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * 版权：卓灿教育集团 版权所有
 * author :赵航
 *
 * @e-mail: zhaohangcn@gmail.com
 * time：2021/2/17
 * describe ：
 */
public class JDBCDome2 {
    public static void main(String[] args) {
        Connection connection = null;
        PreparedStatement prSt = null;
        try {
            connection = JDBCUtils.getConnection();

            String sql = "insert into account values(null,?,?)";

            prSt = connection.prepareStatement(sql);
            prSt.setString(1, "feifei");
            prSt.setDouble(2, 3000);
            int count = prSt.executeUpdate();
            System.out.println(count);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {

            JDBCUtils.close(prSt,connection);
        }
    }
}
